
import { observable, action, computed, toJS } from "mobx";
import * as Apis from "../../apis/common/commonApi";
import { ListViewPage, Browser } from "weaver-mobile-page";
import { Bubble, tools } from 'weaver-mobile';

const { getLabel } = tools;


export default class CommonStore {

  @observable hasOdocExchangeStandard = false;
  //@observable isStandard = false;
  @observable list = new ListViewPage.Store({ route: '/*' });
  @observable loading = false;

  @computed get isStandard() {
    return ( 1 ==
      (this.loading && this.list.data.length !== 0 && this.list.data.filter((item, i) => {
        return item.num != '032';
      }).map(d => d.id).length)
    );
  }

  @action('判断是否开启公文交换非标')
  getStandardFuncInfo = () => {
    const params = {
      templateType: '0',
      templateName: '公文交换'
    }
    Apis.getStandardFuncInfo(params).then(data => {
      if (data.sessionkey) {
        this.list.getData({ dataKey: data.sessionkey }, () => {
          this.loading = true;
        });
      }
    })
  }

}